﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyTimer : MonoBehaviour
{
    public float time = 0f;

    private bool awake = false;
    private float goneTime = 0f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (awake)
        {
            goneTime += Time.deltaTime;
            if (goneTime >= time)
            {
                awake = false;
                goneTime = 0;
                gameObject.transform.position = new Vector3(-10, -10, 0);
                gameObject.SetActive(false);
            }
        }
    }

    public void Init()
    {
        awake = true;
        goneTime = 0;
    }
}
